package com.bifrost.model.vo;

import com.bifrost.entity.Role;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

/**
 * Author by yanxiaobo
 * Date on 2018/4/20$.
 */
@Getter
@Setter
@Builder
public class RoleVO {
    private Integer id;
    private String roleName;
    private String description;

    Set<PermissionVO> permissions = new HashSet<>();
    Set<UserVO> users = new HashSet<>();

    public static RoleVO adapter(Role role) {
        RoleVO vo = RoleVO.builder()
                .id(role.getId())
                .roleName(role.getRoleName())
                .description(role.getDescription())
                .build();
        return vo;
    }

}
